var cssmenuids=["cssmenu1"]; //Enter id(s) of CSS Horizontal UL menus, separated by commas
var csssubmenuoffset=0; //Offset of submenus from main menu. Default is 0 pixels.

function createcssmenu2(){
	for (var i=0; i<cssmenuids.length; i++){
		var current = document.getElementById(cssmenuids[i])
		if (current != null) {
			var atags=current.getElementsByTagName("a");
			for (var t=0; t<atags.length; t++){
				var atag = atags[t];
				if (atag.parentNode.parentNode.id==cssmenuids[i]) {
					//atag.className="arrowdiv";
					atag.innerHTML = atag.innerHTML;
					//atag.innerHTML = "&nbsp;&nbsp;&nbsp;" + atag.innerHTML;
				}
			}
			
			var ultags=current.getElementsByTagName("ul");
			for (var t=0; t<ultags.length; t++){
				var atag = ultags[t].parentNode.getElementsByTagName("a")[0];
				if (ultags[t].parentNode.parentNode.id==cssmenuids[i]){ //if this is a first level submenu
					ultags[t].style.top=ultags[t].parentNode.offsetHeight+csssubmenuoffset+"px"; //dynamically position first level submenus to be height of main menu item
				}
				else	{ //else if this is a sub level menu (ul)
					ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+csssubmenuoffset+"px"; //position menu to the right of menu item that activated it
					atag.className="subfoldericon";
				}
	
		    	ultags[t].parentNode.onmouseover=function(){
			    	this.getElementsByTagName("ul")[0].style.visibility="visible";
		    	}
		    	ultags[t].parentNode.onmouseout=function(){
					this.getElementsByTagName("ul")[0].style.visibility="hidden";
			    }
		    }
	    }
	}
}

if (window.addEventListener)
window.addEventListener("load", createcssmenu2, false)
else if (window.attachEvent)
window.attachEvent("onload", createcssmenu2)

